#ifndef SLT_SERVER_H
#define SLT_SERVER_H

#include <pthread.h>
#include "php.h"
#include "silent.h"

#define HOST_MAX_LEN	16

typedef struct _slt_thread_pool_handler {
	pthread_t tid;
	reactor_t reactor;	
} slt_thread_pool_handler_t;

typedef zval *(*call_rcv_func_t)(int schedid, char *data, int len);
typedef void (*call_connection_func_t)(char *ip, int schedid);
typedef zval *(*call_done_func_t)(char *buff, int len);

typedef struct _slt_server {
	long port;
	int backend;
	long mode;
	char host[HOST_MAX_LEN];
	int sock;
	int schedid;
	int poll_thread_num;
	int wait_jobnum;
	int job_num;
	zend_llist task_list;
	long ticktime;
	pthread_t *wait_jobtids;
	slt_thread_pool_handler_t *pool;
	int max_conn;
	factory_t factory;
	call_rcv_func_t call_rcv;
	call_connection_func_t call_connection;
	call_done_func_t call_done;
} slt_server_t;


void slt_server_init(slt_server_t *serv);
void slt_server_create(slt_server_t *serv);


#endif
